<template>
	<Table :columns="columns1" :data="items">
        <template slot-scope="{ row }" slot="sex">
            <span v-if="Number(row.sex)===1">男</span>
            <span v-else-if="Number(row.sex)===2">女</span>
            <span v-else>-</span>
        </template>
        <template slot-scope="{ }" slot="imgs">
            <div class="imgs">
                <div>
                    <img width="80" height="80" src="https://gss0.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/060828381f30e92444afb07d4a086e061d95f777.jpg" alt="">
                </div>
            </div>
        </template>
    </Table>
</template>
<script>
import { customerPageReportList } from '@api/customer.js'
export default {
    props: {
        cur: {
            type: Object,
            required: true,
            default: {},
        }
    },
	data() {
		return {
            items: [],
			columns1: [
				{
					title: '档案编号',
					align: 'left',
					slot: 'customerFileNumber',
                    idx:1,
				},
				{
					title: '姓名',
					align: 'left',
					slot: 'customerName',
                    idx:2,
                },
				{
					title: '性别',
					align: 'left',
                    idx:3,
					slot: 'sex',
                },
                {
					title: '性别',
					align: 'left',
                    idx:3,
					slot: 'img',
				},
			],
		}
    },
    mounted() {
        this.init()
    },
    methods: {
        init() {
            const { id } = this.cur;
            if (id) {
                customerPageReportList({
                    page: 1,
                    pageSize:5,
                    customerId: id
                }).then(res => {
                    console.log("customerPageReportList ->" , res)
                    if (res.code === "0") {
                        this.items = res.data.items;
                    }
                })
            }
        },
    },
    watch: {
        cur(after){
            this.init()
        }
    }
}
</script>
<style lang="scss" scoped>
    img{
        margin: 10px;
        border-radius: 4px;
    }
</style>
